package com.qidian.mes.quality.controller;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.pojo.Detect;
import com.qidian.mes.pojo.Model;
import com.qidian.mes.quality.service.ModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author gfdycxy
 * @Company cxy
 * @Description
 * @Time 2024/10/18 13:44
 */
@RestController
@CrossOrigin
@RequestMapping("/model")
public class ModelController {
    @Autowired
    private ModelService modelService;

    @GetMapping("/list")
    public MESResult list() {
        return modelService.selectAll();
    }

    @DeleteMapping("/deleteById")
    public MESResult deleteById(Long modelId) {
        return modelService.deleteById(modelId);
    }
    @GetMapping("/getModelById")
    public MESResult getModelById(Long modelId){
        return modelService.queryById(modelId);
    }
    @PostMapping("/insert")
    public MESResult insert(@RequestBody Model model) {
        return modelService.insert(model);
    }
    @PutMapping("/update")
    public MESResult update(@RequestBody Model model) {
        return modelService.updateById(model);
    }
    @GetMapping("/detectList")
    public MESResult detectList() {
        return modelService.selectAllDetect();
    }
    @PutMapping("/updateDetectionById")
    public MESResult updateDetectionById(@RequestBody Detect detect) {
        return modelService.updateDetectionById(detect);
    }
    @DeleteMapping("/deleteModelDetectionById")
    public MESResult deleteModelDetectionById(Long detectId) {
        return modelService.deleteModelDetectionById(detectId);
    }
    @GetMapping("/getModelDetectById")
    public MESResult getModelDetectById(Long detectId){
        return modelService.getModelDetectById(detectId);
    }
    @PostMapping("/insertNewModelDetection")
    public MESResult insertNewModelDetection(@RequestBody Detect detect) {
        return modelService.insertNewModelDetection(detect);
    }
}